/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webservice;

import java.io.File;
import java.io.InputStream;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;

/**
 *
 * @author Tudor
 */
public class DummyWebservice {

    StreamedContent file;
    String country;

    public DummyWebservice() {
        country = null;
    }

    public StreamedContent download() {
        InputStream stream = ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext()).getResourceAsStream("/resources/examples/ROU.xml");
        file = new DefaultStreamedContent(stream, "file/xml", country+".xml");
        return file;
    }

    public StreamedContent getFile() {
        return download();
    }
    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }
}
